﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shapes;
using System.Windows.Media;
using AgilePlannerDT.Utils;

namespace AgilePlannerDT.Display.CustomWidgets
{
    public class TranslateOnlyArea : UserControl
    {
        #region Constants

        public static readonly double TRANSLATE_ONLY_AREA_RADIUS =75;
        
        #endregion

        #region Attributes

        protected Ellipse translateOnlyArea;
        protected double radius;

        #endregion


        public TranslateOnlyArea() : this(TRANSLATE_ONLY_AREA_RADIUS)
        {
        }

        public TranslateOnlyArea(double radius)
        {
            Width = 2 * radius;
            Height = 2 * radius;
            this.radius = radius;

            Background = Brushes.Transparent;

            translateOnlyArea = new Ellipse();
            translateOnlyArea.Width = radius * 2;
            translateOnlyArea.Height = radius * 2;

            translateOnlyArea.Stroke = Brushes.Black;
            translateOnlyArea.StrokeThickness = 1;

            translateOnlyArea.Fill = new SolidColorBrush(Color.FromArgb(127, 127, 127, 127));

            AddChild(translateOnlyArea);
        }

        public bool IsInsideTranslateOnlyArea(Point p)
        {
            return (Util.GetDistance2D(p, new Point(Width / 2,  Height / 2)) < radius); 
        }
    }
}
